#include "formtoolboxinfowidget.h"
#include "ui_formtoolboxinfowidget.h"

FormToolBoxInfoWidget::FormToolBoxInfoWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FormToolBoxInfoWidget)
{
    ui->setupUi(this);
    ui->lineEdit->setText("1");//default count.

    //init widget
    ui->timeedit_starttime->setTime(QDateTime::currentDateTime().time());
    ui->timeedit_cycle->setTime(QTime(0,5));

    connect(ui->timeedit_starttime,&QTimeEdit::timeChanged,this,&FormToolBoxInfoWidget::sig_StartTimeChangeed);
    connect(ui->timeedit_cycle,&QTimeEdit::timeChanged,this,&FormToolBoxInfoWidget::sig_CycleTimeChangeed);
    connect(ui->lineEdit,&QLineEdit::textChanged,this,&FormToolBoxInfoWidget::sig_CountStartPutChangeed);

    ui->timeedit_starttime->setWrapping(true);
    ui->timeedit_cycle->setWrapping(false);
}

FormToolBoxInfoWidget::~FormToolBoxInfoWidget()
{
    delete ui;
}

void FormToolBoxInfoWidget::setcount(int count)
{
    ui->lineEdit->setText(QString::number(count));
}

int FormToolBoxInfoWidget::getcount()
{
    return ui->lineEdit->text().toInt();
}

QTime FormToolBoxInfoWidget::getCyleTime()
{
    return ui->timeedit_cycle->time();
}

QTime FormToolBoxInfoWidget::getStartTime()
{
    return ui->timeedit_starttime->time();
}

void FormToolBoxInfoWidget::setStartTime(QTime time)
{
    ui->timeedit_starttime->setTime(time);
}

void FormToolBoxInfoWidget::setCyleTime(QTime time)
{
    ui->timeedit_cycle->setTime(time);
}
